<!DOCTYPE html>
<html>

<head>
    <meta charset="utf-8">
    <title>tl-ops-manage-后台管理</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport"
        content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
    <script src="lib/axios.js"></script>
    <script src="lib/layui/layui.js" v="layui" e="layui"></script>
    <link rel="stylesheet" type="text/css" href="lib/layui/css/layui.css" />
    <link href="https://qnproxy.iamtsm.cn/44826979.png" rel="shortcut icon" type="image/x-icon">
</head>

<style>
    .tl-icon-side-flex{
        position: relative;
        padding-right: 30px;
    }
    .layui-layout-admin .layui-side{
        transition: width 0.5s;
    }
    .layui-header{
        transition: all 0.5s;
    }
    .layui-layout-admin .layui-body{
        padding-bottom: 0px;
    }
</style>

<body class="layui-layout-body">

    <div class="layui-layout layui-layout-admin">
        <div class="layui-header">
            <div class="layui-logo layui-hide-xs layui-bg-black">
                <span id="tl-logo-title">tl-ops-manage</span>
                <i class="layui-icon layui-icon-tree" id="tl-logo-icon" style="display: none;"></i>
            </div>
            <ul class="layui-nav layui-layout-left">
                <li class="layui-nav-item" lay-unselect>
                    <a href="javascript:;" title="侧边伸缩" onclick="tl_side_flex_click()">
                        <i class="layui-icon layui-icon-shrink-right" ></i>
                    </a>
                </li>
            </ul>
            <ul class="layui-nav layui-layout-right" lay-filter="layadmin-layout-right">
                <li class="layui-nav-item" lay-unselect>
                    <a href="javascript:;">
                        <cite id="tl-ops-username">未登录</cite>
                    </a>
                    <dl class="layui-nav-child">
                        <dd style="text-align: center;" onclick="logout()"><a>退出</a></dd>
                    </dl>
                </li>
            </ul>
        </div>

        <div class="layui-side layui-bg-black layui-side-menu" style="transition: all 0.1s;" id="tl-side-menu" lay-filter="tl-side-menu">
            <div class="layui-side-scroll">
                <ul class="layui-nav layui-nav-tree" lay-shrink="all">
                    <li data-name="console" class="layui-nav-item tl-nav-item">
                        <a href="javascript:;" lay-tips="数据统计" lay-direction="5">
                            <i class="layui-icon layui-icon-console tl-icon"></i>
                            <cite>数据统计</cite>
                        </a>
                        <dl class="layui-nav-child" onclick="openpage('console/tl_ops_web_console.html')">
                            <dd data-name="console-manage">
                                <a>数据统计</a>
                            </dd>
                        </dl>
                        <dl class="layui-nav-child" onclick="openpage('console/tl_ops_web_console_balance_count.html')">
                            <dd data-name="console-balance-count-manage">
                                <a>负载统计</a>
                            </dd>
                        </dl>
                        <dl class="layui-nav-child" onclick="openpage('console/tl_ops_web_console_waf_count.html')">
                            <dd data-name="console-waf-count-manage">
                                <a>WAF统计</a>
                            </dd>
                        </dl>
                    </li>
                    <li data-name="service" class="layui-nav-item tl-nav-item">
                        <a href="javascript:;" lay-tips="服务管理" lay-direction="5">
                            <i class="layui-icon layui-icon-component tl-icon"></i>
                            <cite>服务管理</cite>
                        </a>
                        <dl class="layui-nav-child" onclick="openpage('service/tl_ops_web_service.html')">
                            <dd data-name="service-manage">
                                <a>服务管理</a>
                            </dd>
                        </dl>
                    </li>
                    <li data-name="balance" class="layui-nav-item tl-nav-item">
                        <a href="javascript:;" lay-tips="路由管理" lay-direction="5">
                            <i class="layui-icon layui-icon-release tl-icon"></i>
                            <cite>路由管理</cite>
                        </a>
                        <dl class="layui-nav-child" onclick="openpage('balance/tl_ops_web_balance.html')">
                            <dd data-name="api-manage">
                                <a>路由码配置</a>
                            </dd>
                        </dl>
                        <dl class="layui-nav-child" onclick="openpage('balance/tl_ops_web_api.html')">
                            <dd data-name="api-manage">
                                <a>请求API路由</a>
                            </dd>
                        </dl>
                        <dl class="layui-nav-child" onclick="openpage('balance/tl_ops_web_param.html')">
                            <dd data-name="param-manage">
                                <a>请求参数路由</a>
                            </dd>
                        </dl>
                        <dl class="layui-nav-child" onclick="openpage('balance/tl_ops_web_cookie.html')">
                            <dd data-name="cookie-manage">
                                <a>请求Cookie路由</a>
                            </dd>
                        </dl>
                        <dl class="layui-nav-child" onclick="openpage('balance/tl_ops_web_header.html')">
                            <dd data-name="header-manage">
                                <a>请求头路由</a>
                            </dd>
                        </dl>
                        <dl class="layui-nav-child" onclick="openpage('balance/tl_ops_web_body.html')">
                            <dd data-name="body-manage">
                                <a>请求Body参数路由</a>
                            </dd>
                        </dl>
                    </li>
                    <li data-name="health" class="layui-nav-item tl-nav-item">
                        <a href="javascript:;" lay-tips="服务健康配置" lay-direction="5">
                            <i class="layui-icon layui-icon-set tl-icon"></i>
                            <cite>服务健康配置</cite>
                        </a>
                        <dl class="layui-nav-child" onclick="openpage('health/tl_ops_web_health.html')">
                            <dd data-name="health-manage">
                                <a>服务健康配置</a>
                            </dd>
                        </dl>
                    </li>
                    <li data-name="limit" class="layui-nav-item tl-nav-item">
                        <a href="javascript:;" lay-tips="服务熔断配置" lay-direction="2">
                            <i class="layui-icon layui-icon-app tl-icon"></i>
                            <cite>服务熔断配置</cite>
                        </a>
                        <dl class="layui-nav-child" onclick="openpage('limit/tl_ops_web_limit.html')">
                            <dd data-name="limit-manage">
                                <a>服务熔断配置</a>
                            </dd>
                        </dl>
                    </li>
                    <li data-name="waf" class="layui-nav-item tl-nav-item">
                        <a href="javascript:;" lay-tips="WAF配置" lay-direction="2">
                            <i class="layui-icon layui-icon-slider tl-icon"></i>
                            <cite>WAF规则配置</cite>
                        </a>
                        <dl class="layui-nav-child" onclick="openpage('waf/tl_ops_web_waf.html')">
                            <dd data-name="waf-manage">
                                <a>WAF码配置</a>
                            </dd>
                        </dl>
                        <dl class="layui-nav-child" onclick="openpage('waf/tl_ops_web_waf_cc.html')">
                            <dd data-name="cc-manage">
                                <a>CC规则配置</a>
                            </dd>
                        </dl>
                        <dl class="layui-nav-child" onclick="openpage('waf/tl_ops_web_waf_ip.html')">
                            <dd data-name="ip-manage">
                                <a>IP黑白名单配置</a>
                            </dd>
                        </dl>
                        <dl class="layui-nav-child" onclick="openpage('waf/tl_ops_web_waf_api.html')">
                            <dd data-name="api-manage">
                                <a>API黑白名单配置</a>
                            </dd>
                        </dl>
                        <dl class="layui-nav-child" onclick="openpage('waf/tl_ops_web_waf_param.html')">
                            <dd data-name="args-manage">
                                <a>请求参数黑白名单配置</a>
                            </dd>
                        </dl>
                        <dl class="layui-nav-child" onclick="openpage('waf/tl_ops_web_waf_cookie.html')">
                            <dd data-name="cookie-manage">
                                <a>Cookie黑白名单配置</a>
                            </dd>
                        </dl>
                        <dl class="layui-nav-child" onclick="openpage('waf/tl_ops_web_waf_header.html')">
                            <dd data-name="header-manage">
                                <a>请求头黑白名单配置</a>
                            </dd>
                        </dl>
                    </li>
                    <li data-name="plugins" class="layui-nav-item tl-nav-item">
                        <a href="javascript:;" lay-tips="插件列表管理" lay-direction="5">
                            <i class="layui-icon layui-icon-vercode tl-icon"></i>
                            <cite>插件列表管理</cite>
                        </a>
                        <dl class="layui-nav-child" onclick="openpage('plugins/tl_ops_web_plugins.html')">
                            <dd data-name="plugins-manage">
                                <a>插件列表管理</a>
                            </dd>
                        </dl>
                    </li>
                    
                    <li data-name="store" class="layui-nav-item tl-nav-item">
                        <a href="javascript:;" lay-tips="数据文件管理" lay-direction="2">
                            <i class="layui-icon layui-icon-template tl-icon"></i>
                            <cite>数据文件管理</cite>
                        </a>
                        <dl class="layui-nav-child" onclick="openpage('store/tl_ops_web_store.html')">
                            <dd data-name="store-manage">
                                <a>数据文件管理</a>
                            </dd>
                        </dl>
                    </li>

                    <li data-name="shdict" class="layui-nav-item tl-nav-item">
                        <a href="javascript:;" lay-tips="共享内存管理" lay-direction="5">
                            <i class="layui-icon layui-icon-key tl-icon"></i>
                            <cite>共享内存管理</cite>
                        </a>
                        <dl class="layui-nav-child" onclick="openpage('shdict/tl_ops_web_shdict_balance.html')">
                            <dd data-name="balance-dict-keys-manage">
                                <a>balance keys管理</a>
                            </dd>
                        </dl>
                        <dl class="layui-nav-child" onclick="openpage('shdict/tl_ops_web_shdict_waf.html')">
                            <dd data-name="waf-dict-keys-manage">
                                <a>waf keys管理</a>
                            </dd>
                        </dl>
                        <dl class="layui-nav-child" onclick="openpage('shdict/tl_ops_web_shdict_plugin.html')">
                            <dd data-name="cache-dict-keys-manage">
                                <a>plugin keys管理</a>
                            </dd>
                        </dl>
                        <dl class="layui-nav-child" onclick="openpage('shdict/tl_ops_web_shdict_cache.html')">
                            <dd data-name="cache-dict-keys-manage">
                                <a>cache keys管理</a>
                            </dd>
                        </dl>
                    </li>

                    <li data-name="store" class="layui-nav-item tl-nav-item">
                        <a href="javascript:;" lay-tips="说明文档" lay-direction="2">
                            <i class="layui-icon layui-icon-read tl-icon"></i>
                            <cite>使用手册</cite>
                        </a>
                        <dl class="layui-nav-child">
                            <dd data-name="store-manage">
                                <a target="_blank" href="https://book.iamtsm.cn/">操作文档</a>
                            </dd>
                        </dl>
                        <dl class="layui-nav-child">
                            <dd data-name="store-manage">
                                <a target="_blank" href="https://book.iamtsm.cn/code/service/">开发文档</a>
                            </dd>
                        </dl>
                        <dl class="layui-nav-child">
                            <dd data-name="store-manage">
                                <a target="_blank" href="https://github.com/iamtsm/tl-ops-manage/issues">需求/缺陷反馈</a>
                            </dd>
                        </dl>
                        <dl class="layui-nav-child">
                            <dd data-name="store-manage">
                                <a target="_blank" href="https://jq.qq.com/?_wv=1027&k=TKCwMBjN">QQ交流群 : 624214498</a>
                            </dd>
                        </dl>
                    </li>
                </ul>
                
                <div style="position: relative; bottom: 10px; z-index: 10000; color: white;margin-left: 14px;margin-top: 40px;max-width: 180px;">
                    <a target="_blank" href="https://github.com/iamtsm/tl-ops-manage" style="text-decoration: underline;color: white;    font-weight: bold;">
                        Copyright @ 2021 iamtsm
                    </a>
                </div>
            </div>
        </div>

        <div class="layui-body">
            <iframe src="console/tl_ops_web_console.html" width="100%" height="100%" frameborder="0"
                id="tl-ops-web-index-iframe"></iframe>
        </div>
    </div>

    <script>
        layui.use(['element', 'layer', 'util'], function () {
            var element = layui.element, layer = layui.layer, $ = layui.$;

            function getCookie(name){
                var cookies = document.cookie.split("; ");
                for ( var i = 0; i < cookies.length; i++) {
                    var arr = cookies[i].split("=");
                    if (arr[0].trim() === name){
                        return arr[1];
                    }
                }
                return "";
            }

            $("#tl-ops-username")[0].innerText = getCookie("_u_name")
            window.logout = function () {
                $.ajax({
                    url: '/tlops/auth/logout',
                    success: function(res){
                        window.location.reload();
                    }
                });
            };
            window.openpage = function (url) {
                $("#tl-ops-web-index-iframe")[0].src = url;
            }
            $(".tl-nav-item").on('click', function(){
                tl_side_flex(true)
                tl_side_flex_big = true
            })
            window.tl_side_flex_big = true;
            window.tl_side_flex_click = function(){
                tl_side_flex(!tl_side_flex_big)
                tl_side_flex_big = !tl_side_flex_big
            }
            window.onresize = function(){
                tl_side_flex(tl_side_screen() >= 2)
                tl_side_flex_big = tl_side_screen() >= 2
                if(tl_side_screen() < 1){
                    $(".layui-header").css("left","-220px")
                }
            }
            window.tl_side_flex = function(big){
                if(big){
                    $("#tl-side-menu").css("width","200px");
                    $(".tl-icon").removeClass("tl-icon-side-flex");
                    $(".layui-header").css("left","0")
                    $("#tl-logo-title").css("display","revert");
                    $("#tl-logo-icon").css("display","none");
                    $("#tl-logo-icon").css("position","relative");
                    $("#tl-logo-icon").css("marginLeft","0");
                    $(".layui-body").css("left","200px");
                }else{
                    $("#tl-side-menu").css("width","60px");
                    $(".tl-icon").addClass("tl-icon-side-flex");
                    $(".layui-header").css("left","-140px")
                    $("#tl-logo-title").css("display","none");
                    $("#tl-logo-icon").css("display","revert");
                    $("#tl-logo-icon").css("position","absolute");
                    $("#tl-logo-icon").css("marginLeft","60px");
                    $(".layui-body").css("left","60px");

                    let childNav = document.querySelectorAll(".layui-nav-tree")[0].children
                    for(let child in childNav){
                        if(childNav[child].className && childNav[child].className.indexOf('layui-nav-itemed') > -1){
                            childNav[child].className = 'layui-nav-item tl-nav-item'
                        }
                    }
                }
            }
            window.tl_side_screen = function(){
                var width = $(window).width()
                if (width > 1200) {
                    return 3; //大屏幕
                } else if (width > 992) {
                    return 2; //中屏幕
                } else if (width > 768) {
                    return 1; //小屏幕
                } else {
                    return 0; //超小屏幕
                }
            }
            window.onresize()
        });
    </script>

</body>

</html>